#include "menu.h"
extern int TEMPbuf[];

void StartMenu()
{
	LCDShowStr(1,0,"The DAS of TEMP");
	LCDShowStr(6,1,"V1.0");
}

void SubmenuOne()
{
	LCDShowStr(0,0,"CH0:");
	DelayXms(300);
	ShowTempData(4,0,TEMPbuf,0);
	LCDShowStr(8,0,"CH2:");
	DelayXms(300);
	ShowTempData(12,0,TEMPbuf,2);
	LCDShowStr(0,1,"CH1:");
	DelayXms(300);
	ShowTempData(4,1,TEMPbuf,1);
	LCDShowStr(8,1,"CH3:");
	DelayXms(300);
	ShowTempData(12,1,TEMPbuf,3);
}

void SubmenuTwo()
{
	LCDShowStr(0,0,"CH4:");
	DelayXms(300);
	ShowTempData(4,0,TEMPbuf,4);
	LCDShowStr(8,0,"CH6:");
	DelayXms(300);
	ShowTempData(12,0,TEMPbuf,6);
	LCDShowStr(0,1,"CH5:");
	DelayXms(300);
	ShowTempData(4,1,TEMPbuf,5);
	LCDShowStr(8,1,"CH7:");
	DelayXms(300);
	ShowTempData(12,1,TEMPbuf,7);
}

void SubmenuThree()
{
	LCDShowStr(0,0,"CH8:");
	DelayXms(300);
	ShowTempData(4,0,TEMPbuf,8);
	LCDShowStr(8,0,"CHA:");
	DelayXms(300);
	ShowTempData(12,0,TEMPbuf,10);
	LCDShowStr(0,1,"CH9:");
	DelayXms(300);
	ShowTempData(4,1,TEMPbuf,9);
	LCDShowStr(8,1,"CHB:");
	DelayXms(300);
	ShowTempData(12,1,TEMPbuf,11);
}

void SubmenuFour()
{
	LCDShowStr(0,0,"CHC:");
	DelayXms(300);
	ShowTempData(4,0,TEMPbuf,12);
	LCDShowStr(8,0,"CHE:");
	DelayXms(300);
	ShowTempData(12,0,TEMPbuf,14);
	LCDShowStr(0,1,"CHD:");
	DelayXms(300);
	ShowTempData(4,1,TEMPbuf,13);
	LCDShowStr(8,1,"CHF:");
	DelayXms(300);
	ShowTempData(12,1,TEMPbuf,15);
}

void ShowTempData(unsigned char x,unsigned char y,int *buf,unsigned char num)
{
	LCDSetPosition(x,y);
	LCDWriteData(*(buf + num) / 100 + '0');
	LCDWriteData(*(buf + num) / 10 % 10 + '0');
	LCDWriteData('.');
	LCDWriteData(*(buf + num) % 10 + '0');
}

void AlarmSetMenu()
{
	LCDShowStr(0,0,"   ");
	LCDShowStr(4,0,"ALARM MENU");
}